
<!-- 
@descrition: '' 
@auth: '' 
-->
<template>
	<view>
		<view class="input m-t-40">
			<u-field 
				label-width="0" 
				v-model="account" 
				placeholder="请输入账号" 
				:label-width="80"
				label-align="center"
				:border-bottom="false"
				:style="{ width: '100%' }" 
				type="number" >
				<template v-slot:icon>
				    <image class="field-left-icon" src="/static/img/Home/icon11-18.png"></image>
				</template>
			</u-field>
			
		</view>
		
		<view class="input m-t-40">
			<u-field
				label-width="0" 
				v-model="password" 
				:label-width="80"
				label-align="center"
				placeholder="请输入密码" 
				:border-bottom="false"
				:style="{ width: '100%' }" 
				type="password" >
				<template v-slot:icon>
				    <image class="field-left-icon" src="/static/img/Home/mm2.png"></image>
				</template>
				<template v-slot:right>
				</template>
			</u-field>
		</view>
		
		<view class="input m-t-40">
			<button class=" login-btn white login-btn-user" @tap="loginFun" :class="{ disabled: isDisabled }">
				登录
			</button>
		</view>
	
		
	</view>
</template>

<script>
/**
	 * @descrition: '' 
	 * @auth: '' 
	 */
	export default {
		props: {
			loginType: {
				type: Number,
				default: 1
			},
			isAgree: {
				type: Boolean,
				default: false
			}
			
		},
		data() {
			return {
				account: '',
				password: '',
				code: ''
			}
		},
		computed: {},
		watch:{},
		created() {},
		mounted() {},
		methods: {
			async loginFun() {
				const {
					account,
					password,
					code,
				} = this;
				
				if (!account) {
					this.$toast({
						title: "请输入手机号",
					});
					return;
				}
				
				if (this.loginType == 1 && !password) {
					this.$toast({
						title: "请输入密码",
					});
					return;
				}
				if (this.loginType == 2 && !code) {
					this.$toast({
						title: "请输入验证码",
					});
					return;
				}
				if (!this.isAgree) {
					this.$emit('agree')
					return;
				}
				// 这里只表示验证成功 
				return this.$emit("success", {
					scene: this.loginType,
					account,
					password,
					code,
					
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	$input-h: 100rpx;
	.input {
		height: $input-h;
		border-radius: 999px;
		display: flex;
		align-items: center;
		background: #ffffff;
		overflow: hidden;
	}
	.field-left-icon {
	    width: 30rpx;
	    height: 30rpx;
	}
	.login-btn {
		width: 100%;
		height: 100%;
		line-height: $input-h;
		font-size: 38rpx;
		color: #000000;
	}
</style>